import { http } from '@/utils'

// import type { ResType } from './shared'

// 1.详情 接口
export interface Response {
    code: number;
    data: Datum[];
    relate_files: RelateFile[];
    relate_sku: RelateSku[];
    [property: string]: any;
}
//  1.1 详情
export interface Datum {
    abstracts?: string;
    alt?: string;
    banner?: null;
    caption?: string;
    category?: number;
    category2?: number;
    category2_name?: string;
    category3?: number;
    category3_name?: string;
    category_name?: string;
    content?: null;
    default_image?: string;
    description?: string;
    display?: number;
    id?: number;
    images?: string;
    images_alt?: string;
    is_deleted?: boolean;
    keywords?: string;
    recommended?: number;
    related?: string;
    related_files?: string;
    release_time?: string;
    router?: string;
    sequence?: number;
    sku_content?: SkuContent[];
    tag?: null;
    title?: string;
    update_time?: string;
    views?: null;
    [property: string]: any;
}
//  1.2 规格详情
export interface SkuContent {
    content: string;
    id: number;
    is_open: number;
    title: string;
    [property: string]: any;
}
//  1.3 相关文件详情
export interface RelateFile {
    alt?: null;
    banner?: null;
    caption?: null;
    category?: string;
    content?: null;
    default_image?: null;
    description?: null;
    display?: number;
    id?: number;
    is_deleted?: null;
    keywords?: null;
    product?: null;
    recommended?: null;
    release_time?: string;
    router?: null;
    sequence?: null;
    size?: null;
    title?: string;
    type?: string;
    update_time?: string;
    url?: string;
    views?: null;
    [property: string]: any;
}
//  1.4 相关产品详情
export interface RelateSku {
    alt: string;
    default_image: string;
    id: number;
    title: string;
    [property: string]: any;
}

export type ReqParams = {
    id: string | undefined
  }
export function fetchProDetailAPI(params: ReqParams) {
    return http.request<Response>({
      url: '/product/detail/',
      params,
    })
  }